package com.zzty.common;

import java.io.*;

public class ReadFile {
    public StringBuilder readJava(String filePath) {
        StringBuilder sb= new StringBuilder("");
        try {
            // read file content from file
            //FileReader reader = new FileReader(filePath);
            //BufferedReader br = new BufferedReader(reader);

            FileInputStream in = new FileInputStream(filePath);
            BufferedReader br = new BufferedReader(new InputStreamReader(in,"UTF-8"));
            String str = null;
            while((str = br.readLine()) != null) {
                sb.append(str + "<br/>");
            }
            br.close();
            in.close();
        }
        catch(FileNotFoundException e) {
            e.printStackTrace();
        }
        catch(IOException e) {
            e.printStackTrace();
        }
        return sb;
    }

}
